package com.jsy.mini12306.ticketsales.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.jsy.mini12306.common.entity.SeatType;
import com.jsy.mini12306.common.entity.TrainStationSeatStatus;
import com.jsy.mini12306.ticketsales.bo.DrivingPlan;
import com.jsy.mini12306.ticketsales.entity.SeatLocation;
import com.jsy.mini12306.ticketsales.entity.TrainPatternSeatMap;
import com.jsy.mini12306.ticketsales.exception.TicketSaleCoreException;
import com.jsy.mini12306.ticketsales.mapper.TrainStationSeatStatusMapper;

import java.util.Map;

/**
 * @author: SongyangJi
 * @description:
 * @since: 2021/9/2
 */


public interface RemainingSeatsService extends IService<TrainStationSeatStatus> {

    Map<SeatType, Integer> checkAvailSeatsOfDrivingPlan(DrivingPlan drivingPlan);

    int checkAvailSeatsOfDrivingPlan(DrivingPlan drivingPlan, SeatType seatType);

    boolean hasAvailSeats(DrivingPlan drivingPlan);

    boolean hasAvailSeats(DrivingPlan drivingPlan, SeatType seatType);

    SeatLocation buyTicketAndOccupySeat(DrivingPlan drivingPlan, SeatType seatType) throws TicketSaleCoreException;

    SeatLocation buyTicketAndOccupySeatWithXLock(DrivingPlan drivingPlan, SeatType seatType) throws TicketSaleCoreException;

    SeatLocation buyTicketAndOccupySeatWithSLock(DrivingPlan drivingPlan, SeatType seatType) throws TicketSaleCoreException;

}
